﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="QuizOverview.aspx.vb" Inherits="Assignment4.QuizOverview" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    
    <link href="development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
   
    <link href="CSS/custom-theme/jquery-ui-1.8.11.custom.css" rel="stylesheet" type="text/css" />
    
    <script src="development-bundle/jquery-1.4.4.js" type="text/javascript"></script>

    <style type="text/css">
        .style1
        {
            
        }
        .style2
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script src="jQuery/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
<div id="fb-root"></div>
<script>    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    } (document, 'script', 'facebook-jssdk'));</script>

    <asp:Literal ID="ltrCode" runat="server"></asp:Literal>




    <asp:Literal ID="ltrUsersLiked" runat="server"></asp:Literal>

   





 <ajaxtoolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </ajaxtoolkit:ToolkitScriptManager>
<h1>Quiz Overview</h1>
 
    <table class="style1">
        <tr>
            <td rowspan="2">
                <asp:Image ID="imgQuiz" CssClass="picturequiz" runat="server" />
            </td>
            <td  valign="top">
                <b><asp:Label ID="lblQuizName" runat="server" Text=""></asp:Label></b>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td valign="top">
                <asp:Label ID="lblQuizDescription" runat="server" Text=""></asp:Label>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
        <td colspan="2">
          <ajaxToolkit:Rating ID="LikeRating" runat="server"
                        CurrentRating="0"
                        MaxRating="5"
                        StarCssClass="ratingStar"
                        WaitingStarCssClass="savedRatingStar"
                        FilledStarCssClass="filledRatingStar"
                        EmptyStarCssClass="emptyRatingStar"
                        OnChanged="LikeRating_Changed"
                        style="float: left;" />
        </td>
        
        <td>
            &nbsp;</td>
        
        </tr>
      
        <tr>
        <td colspan="2">
            &nbsp;</td>
        
        <td>
            &nbsp;</td>
        
        </tr>
      
      
      
      
    </table>
    <asp:Literal ID="ltrFacebook" runat="server"></asp:Literal>
    <br />
    <br />
    <asp:Button ID="btnStartQuiz" runat="server" BackColor="#0099FF" Height="44px" 
                Text="Start Quiz" Width="208px" ForeColor="White" />
    
    &nbsp;
    <asp:Label ID="lblQuizError" CssClass="lblmessage" runat="server" Text=""></asp:Label>
    
    <br />
    <hr />
    <h2>Comments</h2>
    <p>
        
    </p>

    <asp:ListView ID="lstViewComments" runat="server" 
        DataSourceID="SqlDataSourceGetQuizComments" OnItemDataBound="ListViewComments_ItemDataBound">
        <ItemTemplate>
        
                   <table class="style1">
        <tr>
            <td rowspan="2" >
                <asp:ImageButton ID="imgAvatar" PostBackUrl='<%# "~/ProfileViewer.aspx?profileId="+Eval("ProfileId").ToString()%>' CssClass="commentsavatar" ImageUrl=<%# Eval("ProfileAvatar")%> runat="server" />
            </td>
            <td>
                <asp:Label ID="lblUserName" runat="server" Text=<%# getName(Eval("ProfileName"),Eval("ProfileSurname"),Eval("CommentDate"))%>></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblCommentContent" runat="server" Text=<%# Eval("CommentContent")%>></asp:Label>
            </td>
        </tr>
        <tr>
           <td>
              
               <asp:Button ID="btnLike" OnClick="ButtonLike_Click"  CommandName=<%# Eval("CommentId")%> runat="server" Text="Like" />
               </td>
               <td>
                 <a id=<%# getButtonId(Eval("CommentId")) %> href="#">  <asp:Label ID="lblLikes" runat="server" Text=<%# getWhoLiked(Eval("CommentId"))%>></asp:Label></a>
           </td>
           <td>
            <asp:Button ID="btnUnLike" OnClick="ButtonUnLike_Click"  CommandName=<%# Eval("CommentId")%> runat="server" Text="Unlike" />
               
               
           </td>
        </tr>
        <tr>
        <td>&nbsp;</td>
        </tr>
       
    </table>   
    <hr />
        </ItemTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSourceGetQuizComments" runat="server" 
        ConnectionString="<%$ ConnectionStrings:learningConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:learningConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM [QuerySelectCommentsVisibleByQuizIdDesc] WHERE ([QuizId] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="QuizId" QueryStringField="quizId" 
                Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    <table class="style2">
        <tr>
            <td>
                Add Comment</td>
        </tr>
        <tr>
            <td>
                <asp:TextBox ID="txtCommentSubmit" runat="server" Height="52px" 
                    TextMode="MultiLine" Width="863px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="txtCommentSubmit" CssClass="lblmessage" 
                    ErrorMessage="Enter Comment" ValidationGroup="add"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="btnAddComment" runat="server" Text="Add Comment" 
                    ValidationGroup="add" />
                
            </td>
        </tr>
        <tr>
            <td>
                
                <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
            &nbsp;</td>
            
        </tr>
    </table>
    </br>



   



</asp:Content>
